package com.noble.meether.chat.ui.agora.act.mail;

import android.widget.TextView;

import com.noble.meether.R;
import com.noble.library.utils.StringUtils;
import com.noble.library.widget.RecyclerView.base.BaseRecyclerViewAdapter;
import com.noble.library.widget.RecyclerView.base.BaseRecyclerViewHolder;

/**
 * 音视频聊天中消息展示
 */
public class RtcMsgAdapter extends BaseRecyclerViewAdapter {
    @Override
    public int[] getItemLayouts() {
        return new int[]{R.layout.item_rtc_message};
    }

    @Override
    public void onBindRecycleViewHolder(BaseRecyclerViewHolder viewHolder, int position) {
        String msg = (String) getItem(position);
        TextView tvName = viewHolder.findViewById(R.id.msg_name);
        TextView content = viewHolder.findViewById(R.id.msg_content);
        tvName.setText(getName(msg));
        content.setText(getContent(msg));
    }

    private String getName(String msg) {
        return StringUtils.getBeforeNoFlag(msg, "：");
    }

    private String getContent(String msg) {
        return StringUtils.getAfterNoFlag(msg, "：");
    }


    @Override
    public int getRecycleViewItemType(int position) {
        return 0;
    }
}

